package com.zhaodi.mybatisflexdemo.factory;

import com.zhaodi.mybatisflexdemo.entity.SpelDemo;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 * @ClassName SpelDemoFactory
 * @Description TODO
 * @Author 郭敖
 * @Date 2024年09月23日 22:30
 * @Version 1.0
 */
@Component
public class SpelDemoFactory implements FactoryBean<SpelDemo> {
    @Value("#{@nameHandle.getName('1')}")
    private String name;
    @Override
    public SpelDemo getObject() throws Exception {
        SpelDemo spelDemo = new SpelDemo();
        spelDemo.setName(name);
        return spelDemo;
    }

    @Override
    public Class<?> getObjectType() {
        return SpelDemo.class;
    }
}
